<?php include '_init_.php';?>
<?php
$dtMainIndex = new DataTable(constant('DB_TABLE_ORDER_INDEX_MAIN'));
$orderType = isset($_REQUEST['type'])?$_REQUEST['type']:false;
$condition = "`status`='new'";
$orderBy = '-created';
$typeName = "預約資訊";
if($orderType == 'photo')
{
	$condition .= " and `photo_time` != '0000-00-00 00:00:00' and `already_photo` = 'N'";
	$orderBy = 'photo_time';
	$typeName = '拍照資訊';
}else if($orderType == 'proof'){
	$condition .= " and `proof_time` != '0000-00-00 00:00:00' and `already_photo` = 'Y' and `already_proof` = 'N'";
	$orderBy = 'proof_time';
	$typeName = '看樣資訊';
}else if($orderType == 'pickup'){
	$condition .= " and `pickup_time` != '0000-00-00 00:00:00' and `already_photo` = 'Y' and `already_proof` = 'Y' and `already_pickup` = 'N'";
	$orderBy = 'pickup_time';
	$typeName = '取件資訊';
}else if($orderType == 'undetermined'){
	$condition .= " and `photo_time` = '0000-00-00 00:00:00' and `proof_time` = '0000-00-00 00:00:00' and `pickup_time` = '0000-00-00 00:00:00'";
	$orderBy = 'pickup_time';
	$typeName = '未定資訊';
}else{
	$condition .= " and `photo_time` = '0000-00-00 00:00:00' and `already_photo` = 'N' and `already_proof` = 'N' and `already_pickup` = 'N'";
}
$pageSize = 10;
$page = isset($_REQUEST['p'])?intval($_REQUEST['p']):1;
$data_list = $dtMainIndex->get_list($condition,$orderBy,$pageSize,($page - 1)*$pageSize);
$recordCount = $dtMainIndex->get_count($condition);
$pageCount = ceil($recordCount/$pageSize);
?>
<?php include 'page_header.php';?>
<div id="main"><!-- start #main //-->
<div id="tita">
  <div class="tita-1">
    <h3><?php echo $typeName;?></h3>
  </div>
  <div class="tita-2"><?php echo date(constant('WEBSITE_DATE_FORMATE'),strtotime(AppMain::getCurrentDate()));?></div>
  </div>
  <div class="clearfix" id="maina"><!-- start #maina //-->
  <?php foreach($data_list as $tmpData):?>
  <div class="maina-1">
    <ul>
      <li class="maina-1a">
        姓名<img width="21" height="12" src="images/line3.gif"><a href="cos.php?id=<?php echo $tmpData['manager_id'];?>"><?php echo $tmpData['c_name'];?></a></li>
      <li class="maina-1a">
        生日<img width="21" height="12" src="images/line3.gif"><?php printf("民國 %s年 %s月 %s日",$tmpData['c_birthday_year'],$tmpData['c_birthday_month'],$tmpData['c_birthday_date'])?>
      </li>
      <li class="maina-1a">
        電話<img width="21" height="12" src="images/line3.gif">(<?php echo $tmpData['c_tel_part_one'];?>)<?php echo $tmpData['c_tel_part_two'];?>
      </li>
      <li class="maina-1a">
       手機<img width="21" height="12" src="images/line3.gif"><?php echo $tmpData['c_mobile'];?>
      </li>
      <li class="maina-1b">
       電郵1<img width="21" height="12" src="images/line3.gif"><?php echo $tmpData['c_email'];?>
      </li>
      <li class="maina-1b">
       地址<img width="21" height="12" src="images/line3.gif"><?php echo $tmpData['c_address_one'];?><?php echo $tmpData['c_address_two'];?><?php echo $tmpData['c_address_three'];?>
      </li>
       <li class="maina-1b">
       電郵2<img width="21" height="12" src="images/line3.gif"><?php echo $tmpData['c_email2'];?>
      </li>
    </ul>
    </div>
    <?php endforeach;?>
    
  </div><!-- end #maina //-->
  
<!-- start #pagea //-->
<?php
$linkParam = '?page=%d';
if($orderType)
	$linkParam .= '&type='.$orderType;
?>
<?php AppMain::paginationUI($pageCount,$page,$linkParam);?>
<!-- end #pagea //-->


  
</div>
<?php include 'page_footer.php';?>